<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="utf-8">
    <title>Cindy JS</title>
    <script type="text/javascript" src="../../build/js/Cindy.js"></script>
    <script type="text/javascript" src="../../build/js/CindyGL.js"></script>
    <link rel="stylesheet" href="../../css/cindy.css">
  </head>
    
	<body style="font-family:Arial;">
    
    <h1>CindyJS: Interference</h1>
    
    
    <script id="csdraw" type="text/x-cindyscript">
      t = seconds()-t0;
      
      waves(z) := (
        da = abs(z - A);
        db = abs(z - B);
        (exp(-.03*da)*sin(da-t)+exp(-.03*db)*exp(-.001*db)*sin(db-t))*.4+.5
      );
      
      colorplot(waves(#));
    </script>
               
    <script id="csinit" type="text/x-cindyscript">
      use("CindyGL");
      t0 = seconds();
    </script>
    

    <div  id="CSCanvas"></div>
    
    <script type="text/javascript">
        
        var gslp=[
                  {name:"A", kind:"P", type:"Free", pos:[-20,-1,1]},
                  {name:"B", kind:"P", type:"Free", pos:[20,5,1]},
                  ];
        CindyJS({canvasname:"CSCanvas",
                    scripts: "cs*",
                    geometry:gslp,
                    animation: {autoplay: true},
                    ports: [{
                      id: "CSCanvas",
                      width: 500,
                      height: 500,
                      transform: [ { visibleRect: [-50,-50, 50, 50] } ]
                    }]
                  });
    </script>              
	</body>
</html>
